﻿

namespace HPSocketLibrary.Devices
{

    /// <summary>
    /// 【消息】上报设备上下线
    /// </summary>
    public class MtMsg_ReportDeviceStatus : MtMsgBase<MtIntfaceMsgFormat_Body_ReportDeviceSTATUS>
    {
        public static MtMsg_ReportDeviceStatus CreateNewMsg(bool isOnline)
        {
            MtMsg_ReportDeviceStatus msg = new MtMsg_ReportDeviceStatus();
            msg.head = MtIntfaceMsgFormat_Head.CreateDefaultRequestMsgHead(MtSSLMsgType.REPORT_DEVICE_STATUS, true);
            msg.body = MtIntfaceMsgFormat_Body_ReportDeviceSTATUS.GetDefault(isOnline);
            return msg;
        }
        /// <summary>
        /// 1：自检2：上线 4：维护（急停）6：故障 7：设备不在线
        /// </summary>
        /// <param name="dcode"></param>
        /// <returns></returns>
        public static MtMsg_ReportDeviceStatus CreateNewMsg(string dcode)
        {
            MtMsg_ReportDeviceStatus msg = new MtMsg_ReportDeviceStatus();
            msg.head = MtIntfaceMsgFormat_Head.CreateDefaultRequestMsgHead(MtSSLMsgType.REPORT_DEVICE_STATUS, true);
            msg.body = MtIntfaceMsgFormat_Body_ReportDeviceSTATUS.CreateByCode(dcode);
            return msg;
        }
    }
}